package cn.edu.cug.cs.gtl.docsrv.shp.querier;

import cn.edu.cug.cs.gtl.docsrv.shp.block.ShapeBlock;
import cn.edu.cug.cs.gtl.mybatis.Session;
import cn.edu.cug.cs.gtl.mybatis.mapper.shp.ShpAll;
import cn.edu.cug.cs.gtl.mybatis.mapper.shp.ShpAllMapper;
import cn.edu.cug.cs.gtl.mybatis.mapper.shp.ShpItem;
import cn.edu.cug.cs.gtl.mybatis.mapper.shp.ShpItemMapper;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;

import java.math.BigDecimal;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * 在ShpManager中执行的单元块级别的查询接口
 */
public interface BlockQuerier extends Iterable<ShapeBlock>{
    //属性查询
    boolean select(Map<String,Object> parameters);

    default boolean selectByName(String shapeDocEnTitle){
        Map<String,Object> map=new LinkedHashMap<>();
        map.put("shpEnTitle",shapeDocEnTitle);
        return select(map);
    }

    default boolean selectByInternalId(BigDecimal shpInternalId){
        Map<String,Object> map=new LinkedHashMap<>();
        map.put("shpInternalId",shpInternalId);
        return select(map);
    }



    //几何查询
    boolean disjoint(Geometry g);
    boolean touches(Geometry g) ;
    boolean intersects(Geometry g) ;
    boolean crosses(Geometry g) ;
    boolean within(Geometry g);
    boolean contains(Geometry g);
    boolean overlaps(Geometry g) ;
    boolean covers(Geometry g) ;
    boolean coveredBy(Geometry g);
    boolean equals(Geometry g);

    //获取Manager的最小边界矩形
    Envelope getAllBlocksEnvelope();
    //获取Manager的最小边界
    Geometry getAllBlocksBoundary();

}
